package monitor

import (
	"log"
)

//avoid invalid value and assembly dimension's target value
func processAndVerifyDimensionsValue(dimension []string, sourceValue map[string]string) []string {
	result := make([]string, len(dimension))
	if len(dimension) == 0 {
		log.Printf("processAndVerifyDimensionsValue error, dimensionLen[%d]", len(dimension))
		return result
	}
	for key, value := range dimension {
		if mapValue, ok := sourceValue[value]; ok {
			result[key] = mapValue
		} else {
			result[key] = ""
		}
	}

	return result
}
